package com.ibeeking.gmc.global.g.rest.controller.v1.feign;


import com.ibeeking.gmc.global.api.common.dto.TenantEnterpriseInfoDTO;
import com.ibeeking.gmc.global.api.common.param.TenantEnterpriseInfoParam;
import com.ibeeking.gmc.global.service.common.vo.TenantEnterpriseInfoVO;
import com.ibeeking.nematos.utils.base.BaseValidationGroup;
import com.ibeeking.nematos.utils.bean.BeanUtil;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/g/enterpriseinfo/feign/v1")
public class TenantEnterpriseInfoFeignController {

    @Resource
    private com.ibeeking.gmc.global.g.rest.service.ITenantEnterpriseInfoService ITenantEnterpriseInfoService;

    @PostMapping("/queryEnterpriseInfoByTenantId/{id}")
    public TenantEnterpriseInfoDTO queryEnterpriseInfoByTenantId(@PathVariable("id") Integer id){
        TenantEnterpriseInfoVO vo = this.ITenantEnterpriseInfoService.viewByTenantId(id);
        TenantEnterpriseInfoDTO dto = BeanUtil.convertBean(vo, TenantEnterpriseInfoDTO.class);
        return dto;
    }

    @PostMapping("/modifyEnterpriseInfo")
    public Boolean modifyEnterpriseInfo(@RequestBody @Validated(BaseValidationGroup.Update.class) TenantEnterpriseInfoParam tenantEnterpriseInfoParam) {
        com.ibeeking.gmc.global.service.common.param.TenantEnterpriseInfoParam param = BeanUtil.convertBean(tenantEnterpriseInfoParam, com.ibeeking.gmc.global.service.common.param.TenantEnterpriseInfoParam.class);
        return  ITenantEnterpriseInfoService.modify(param);
    }

}
